import os
import unittest
from cases.Base_Case import BASECASE
from config.config import DATA_PATH
from page.index import IndexPage
from page.住院公用页面.dianzhibingli__page import Binlibianjiqi
from page.住院护士站.住院护士站.hulijilu__page import hulijibie
from page.住院护士站.住院护士站.zhuyuanhushizhan__page import zhuyuanhushizhan
from page.住院护士站.住院护士站.zidongjifei__page import zidongjifei
from tools.sjqd_way import read_data_from_excel
from page.住院护士站.住院护士站.feiyongbulu__page import feiyongbulu
class TestZhuyuanhushizhan_Chuyuanzunbei(BASECASE):
    @classmethod
    def setUpClass(cls):
        ap = IndexPage()
        ap.jrym_no1('住院护士站')
    @classmethod
    def tearDownClass(cls):
        ap = IndexPage()
        ap.close_all_xxk()
        print("{}执行完毕-------------------------------------------------".format(cls))
    #停止自动收费
    # @unittest.skip
    def test_1_zhuyuanhushizhan_close_zidongjifei(self):
        bp = zhuyuanhushizhan()
        bp.ckick_zdjf()#点击自动计费
        cp = zidongjifei()
        cp.click_qx()#点击全选
        cp.click_tz_btn()#点击停止
        cp.click_tsqd()#点击提示确定按钮
        cp.close_window()#关闭窗口
    #冲减补录
    # @unittest.skip
    def test_2_zhuyuanhushizhan_feiyongbulu(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "冲减补录")
        shuju1,shuju2,shuju3 = self.data[0]
        bp = zhuyuanhushizhan()
        cp = feiyongbulu()
        bp.click_fybl()#点击费用补录
        cp.input_xmmc(shuju1)
        cp.click_dw_btn()#点击定位
        cp.clik_cj_first()#冲减第一条数据
        cp.click_cjqd()#点击冲减确定
        cp.input_xmmc(shuju2)
        cp.click_dw_btn()  # 点击定位
        cp.clik_cj_last()#冲减最后一条数据
        cp.click_cjqd()#点击冲减确定
        cp.add_sfxm(2)#添加项目
        cp.choose_last_xmmc(shuju3)
        cp.click_zc_btn()#点击暂存
        cp.click_tj_btn()#点击提交
        cp.close_window()#关闭窗口

    #停止护理级别
    # @unittest.skip
    def test_3_zhuyuanhushizhan_close_hulijibie(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "护理级别")
        hljb = self.data[5][0]
        bp = zhuyuanhushizhan()
        bp.click_hljb()
        cp = hulijibie()
        cp.input_hljb(hljb)#变更护理级别
        cp.click_bc_btn()#点击保存
    #添加电子病历记录
    # @unittest.skip
    def test_4_zhuyuanhushizhan_add_dianzibingli(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "电子病历")
        mbmc,pwd = self.data[1]
        bp = zhuyuanhushizhan()
        bp.chuangwei1.Click()
        bp.click_dzblln_btn()   # 点击电子病历
        cp = Binlibianjiqi()
        cp.click_xz_btn()       # 点击新增按钮
        cp.click_yymb()         # 点击医院模板
        cp.input_mbmc(mbmc)
        cp.click_cz_btn()       # 点击查询
        cp.click_shuju1()       # 点击第一条模板
        cp.click_qd_btn()       # 点击确定按钮
        cp.qianming_(pwd)       # 签名
if __name__ == '__main__':
    unittest.main()
